home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AGA Toolkit '97
/
The AGA Toolkit '97.iso
/
workbench
/
blanker
/
vesa
/
blank.c
next >
Wrap
C/C++ Source or Header
|
1996-09-07
|
4KB
|
125 lines
/*
* Copyright (c) 1996 Mika Kortelainen
* All rights reserved.
*
*/
#include <exec/memory.h>
#include <cybergraphics/cybergraphics.h>
#include "/includes.h"
#ifdef __SASC_60
# include <proto/cybergraphics.h>
#else
# include <clib/cybergraphics_protos.h>
# ifndef _DCC
# include <inline/cybergraphics.h>
# endif
#endif
#define NORMAL 0
#define STANDBY 1
#define SUSPEND 2
#define CYBERGFXNAME "cybergraphics.library"
#define CYBERGFXVERSION 40L
#ifdef __SASC_650
/* use SAS/C 6.5x's autoinit feature */
LONG __CGFXlibversion = CYBERGFXVERSION;
#else
struct Library *CyberGfxBase;
#endif
#include "Vesa_rev.h"
STATIC const UBYTE VersTag[] = VERSTAG;
VOID Defaults( PrefObject *Prefs )
{
Prefs[NORMAL].po_Level = 1;
Prefs[STANDBY].po_Level = 1;
Prefs[SUSPEND].po_Level = 1;
}
LONG Blank( PrefObject *Prefs )
{
struct Screen *FScr;
LONG RetVal;
#ifndef __SASC_650
if ((CyberGfxBase=OpenLibrary(CYBERGFXNAME,CYBERGFXVERSION))==NULL)
{
return FAILED;
}
#endif
if( (FScr = cloneTopScreen(FALSE, TRUE)) )
{
LONG count = 0;
LONG normalMode = Prefs[NORMAL].po_Level * 60;
LONG standbyMode = normalMode + Prefs[STANDBY].po_Level * 60;
LONG suspendMode = standbyMode + Prefs[SUSPEND].po_Level * 60;
struct Window *Wnd;
SetRGB4( &FScr->ViewPort, 0, 0L, 0L, 0L );
SetRast( &FScr->RastPort, 0 );
Wnd = BlankMousePointer( FScr );
ScreenToFront( FScr );
do
{
Delay(50);
if (count == normalMode)
{
CVideoCtrlTags(&FScr->ViewPort,
SETVC_DPMSLevel,
DPMS_STANDBY,
TAG_DONE);
count++;
} else if (count == standbyMode)
{
CVideoCtrlTags(&FScr->ViewPort,
SETVC_DPMSLevel,
DPMS_SUSPEND,
TAG_DONE);
count++;
} else if (count == suspendMode)
{
CVideoCtrlTags(&FScr->ViewPort,
SETVC_DPMSLevel,
DPMS_OFF,
TAG_DONE);
count++;
} else if (count < suspendMode)
{
count++;
}
RetVal = ContinueBlanking();
}
while( RetVal == OK );
CVideoCtrlTags(&FScr->ViewPort,
SETVC_DPMSLevel,
DPMS_ON,
TAG_DONE);
UnblankMousePointer( Wnd );
CloseScreen( FScr );
(void)RethinkDisplay();
} else {
/* Couldn't open screen */
RetVal = FAILED;
}
#ifndef __SASC_650
CloseLibrary(CyberGfxBase);
#endif
return RetVal;
}